import logging
import redis

#配置信息
class  Config(object):
    #调试模式
    DEBUG = True
    #CSRF保护
    SECRET_KEY = 'DASDADADAD'
    #数据库配置
    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://root:mysql@localhost:3306/flask_review'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    #最后登陆时间记录
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    #redis参数
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    #session参数
    SESSION_TYPE = 'redis'
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST,port=REDIS_PORT)

    SESSION_USE_SIGNER = True
    PERMANENT_SESSION_LIFETIME = 3600*24*2
    LEVEL = logging.DEBUG

#开发模式
class DevelopConfig(Config):
    pass

#生产模式
class ProductConfig(Config):
    DEBUG = False

    LEVEL = logging.ERROR
#测试模式
class TestingConfig(Config):
    TESTING = True

#配置字典
config_dict = {
    "develop":DevelopConfig,
    'product':ProductConfig,
    'test':TestingConfig

}